-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add ai snippets #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that this package-lock file has no practical effect 🙂
snippets/ai/src/ai.ts
Outdated
| const { getAiSdkProvider, models } = localRequire<typeof import('./providers/generic/ai-sdk-provider.js')>('./providers/generic/ai-sdk-provider.js'); | ||
| const { Config } = localRequire<typeof import('./config.js')>('./config.js'); | ||
| const { wrapAllFunctions } = localRequire<typeof import('./helpers.js')>('./helpers.js'); | ||
| const chalk = localRequire<typeof import('chalk')>('chalk'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need localRequire in any file except the main entry point (index.js)
| | `ai.query` | Generate a MongoDB query | `ai.query find documents where name = "Ada"` | | ||
| | `ai.aggregate` | Generate a MongoDB aggregation | `ai.aggregate find documents where name = "Ada"` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo data, query, and aggregate should just be 1 command since its all just a type of query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I definitely want to reduce the command types, they have gone overboard.
in your experience, is there no benefit to doing extra prompting for i.e. at least the aggregate function?
| | `ai.query` | Generate a MongoDB query | `ai.query find documents where name = "Ada"` | | ||
| | `ai.aggregate` | Generate a MongoDB aggregation | `ai.aggregate find documents where name = "Ada"` | | ||
| | `ai.collection` | Set the active collection | `ai.collection("users")` | | ||
| | `ai.shell` | Generate general mongosh commands | `ai.shell get sharding info` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming: perhaps ai.command instead?
| | `ai.aggregate` | Generate a MongoDB aggregation | `ai.aggregate find documents where name = "Ada"` | | ||
| | `ai.collection` | Set the active collection | `ai.collection("users")` | | ||
| | `ai.shell` | Generate general mongosh commands | `ai.shell get sharding info` | | ||
| | `ai.general` | Ask general questions to your model | `ai.general what is the meaning of life?` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why include this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I remove this from the code but haven't update the docs.
agree for sake of the snippet I'll remove that. I added a bunch of these to play around with different providers (it also made more sense when I originally was just using non-docs general AI providers)
This is still code that is largely skunkworks-quality so will probably go through a couple more refactors before it's ready to be reviewed / merged but it's quite functional!
One can install this snippet using the
snippetcommand in mongosh: